"""API 请求中使用的与调查相关的功能模块"""
from fastapi import HTTPException

from service.poll_service import PollService, ValidatePollService


class PollServiceAPI(PollService):
    """
    API 用于请求 PollService 实现类.  
    - 这个类是 API我们通过过度驱动实现与相关的特定异常处理.
    """
    def raise_exception(self,
                        status_code: int = 400,
                        detail: str = None,
                        url: str = None) -> None:
        raise HTTPException(status_code=status_code, detail=detail)


class ValidatePollServiceAPI(ValidatePollService):
    """
    API 用于请求 ValidatePollService 实现类.  
    - 这个类是 API我们通过过度驱动实现与相关的特定异常处理.
    """
    def raise_exception(self,
                        status_code: int = 400,
                        detail: str = None,
                        url: str = None) -> None:
        raise HTTPException(status_code=status_code, detail=detail)
